using System;
using System.Data.Linq;

namespace RomanJendrusz.Amazon.ETL.Domain
{
    public class Customer
    {
        private readonly EntitySet<CustomerReview> reviews;
        private DateTime updated;

        public Customer()
        {
            reviews = new EntitySet<CustomerReview>(onAdding, onDeleting);
        }

        public string CustomerId { get; set; }

        public string Nickname { get; set; }

        public string BirthDay { get; set; }

        public string City { get; set; }

        public string State { get; set; }

        public string Country { get; set; }

        public string CustomerName { get; set; }

        public string Location { get; set; }

        public DateTime Updated
        {
            get { return updated; }
        }

        public EntitySet<CustomerReview> Reviews
        {
            get { return reviews; }
            set { reviews.Assign(value); }
        }


        private void onDeleting(CustomerReview obj)
        {
            if (obj != null && obj.Customer == this)
                obj.Customer = null;
        }

        private void onAdding(CustomerReview obj)
        {
            if (obj != null)
                obj.Customer = this;
        }
    }
}